<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<html>
	 <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
        <meta name="format-detection" content="telephone=no">
        <meta charset="UTF-8">

        <meta name="description" content="Violate Responsive Admin Template">
        <meta name="keywords" content="Super Admin, Admin, Template, Bootstrap">
    </head>
    <body>
    		<div id="showShop">
	            <div class="row">
		            <div class="col-md-6">
		            	<h4 class="page-title">店铺信息</h4>
		            	<div class="row">
							<div class="col-md-12 form-group">
								<label>店铺名称</label>&emsp;：<span id="merchantName6"></span>
							</div>
							<div class="col-md-12 form-group">
								<label>店铺类型</label>&emsp;：<span id="merchartClassifyId6"></span>
							</div>
						</div>
						<div class="row">
							<div class="col-md-12 form-group">
								<label>店铺地址</label>&emsp;：<span id="merchantAddress6"></span> 
							</div>
						</div>
						<div class="row">
							<div class="col-md-12 form-group">
								<label>店铺简介</label>&emsp;：<span id="merchartIntro6"></span> 
							</div>
						</div>
		            </div>
		            <div class="col-md-6">
		            	<h4 class="page-title">个人信息</h4>
		            	<div class="row">
							<div class="col-md-12 form-group">
								<label>真实姓名</label>&emsp;：<span id="userName6"></span>
							</div>
							<div class="col-md-12 form-group">
								<label>身份证号</label>&emsp;：<span id="idNo6"></span>
							</div>
						</div>
						<div class="row">
							<div class="col-md-6 form-group">
								<label>手持身份证照片</label>
								<div class="row" id="certificatePhotoDiv">
								</div>
							</div>
							<div class="col-md-6 form-group">
								<label id="handPhoto">手持营业执照</label>
								<div class="row" id="businessPhotoDiv">
								</div>
							</div>
						</div>
		            </div>
	            </div>
	            <div class="row text-center">
                <br>
                <br>
                <div class="col-md-6 form-group">
                	<button class="btn btn-lg btn-primary" style="width: 120px;" onclick="passShop(${merchantId})" type="button">通过</button>
                </div>
                <div class="col-md-6 form-group">
                	<button class="btn btn-lg btn-primary"  style="width: 120px;" onclick="returnShop()" type="button">驳回</button>
               	</div>
                </div>
            </div>
    		<div id="returnShop">
	            <div class="row">
		            <div class="col-md-6">
		            	<div class="row">
							<div class="col-md-12 form-group">
								<label>驳回原因</label>
								<textarea class="input-sm form-control" maxlength="400" id="rejectReason6" name="rejectReason6" style="margin: 0px -306px 0px 0px; width: 576px; height: 84px;"></textarea>
							</div>
						</div>
		            </div>
	            </div>
	            <div class="row text-center">
                <br>
                	<button class="btn btn-lg btn-primary"  style="width: 120px;" onclick="submitInfo()" type="button">提交</button>
                </div>
            </div>
   <input type="hidden" id="merchantId6" value="${merchantId}">
   </body>
   <script type="text/javascript">
   $(function(){
	   $("#returnShop").hide();
		$.ajax({
			 type:"POST",
	         url: "<%=path %>/manager/getShopClassifyList",
	         success: function(data,status,xhr){
	        	 var shopClassifyList=data;
	        	 $.ajax({
	    			 type:"POST",
	    	         url: "<%=path %>/manager/getShopInfoByMerchantId?merchantId="+$("#merchantId6").val(),
	    	         success: function(data,status,xhr){
	    	        	 $("#merchantName6").html(data.merchant.merchantName);
	    	        	 for(var i=0;i<shopClassifyList.length;i++){
	    	        		 if(shopClassifyList[i].classifyId==data.merchant.merchartClassifyId){
	    	        		 	$("#merchantName6").html(shopClassifyList[i].classifyName);
	    	        		 }
	    	        	 }
	    	        	 $("#merchartClassifyId6").html(data.merchant.merchartClassifyId);
	    	        	 $("#merchantAddress6").html(data.merchant.merchantAddress);
	    	        	 $("#merchartIntro6").html(data.merchant.merchartIntro);
	    	        	 $("#userName6").html(data.realName);
	    	        	 $("#idNo6").html(data.idNo);
	    	        	 $('#certificatePhotoDiv').append('<div class="col-xs-12 col-md-12" id="addCertificatePhotoDiv"><img class="img-responsive" src="<%=path %>/manager/getApplyPhoto?photoUrl='+data.merchant.handIdcardImg+'" style="position:relative">'
									+'</div>');
	    	        	 //大学生开店
	    	        	 if(data.merchant.merchantType==2){
	    	        		 $("#handPhoto").html("手持学生证照")
	    	        		 $('#businessPhotoDiv').append('<div class="col-xs-12 col-md-12" id="addBusinessPhotoDiv"><img class="img-responsive" src="<%=path %>/manager/getApplyPhoto?photoUrl='+data.merchant.studentIdImg+'" style="position:relative">'
										+'</div>');
	    	        	 //商家
	    	        	 }else if(data.merchant.merchantType==1){
	    	        		 $("#handPhoto").html("手持营业执照")
	    	        		 $('#businessPhotoDiv').append('<div class="col-xs-12 col-md-12" id="addBusinessPhotoDiv"><img class="img-responsive" src="<%=path %>/manager/getApplyPhoto?photoUrl='+data.merchant.hardBusinessLicenseImg+'" style="position:relative">'
										+'</div>');
	    	        	 }
						 
	    	         }
	    		})
	         }
		})
   });
   function returnShop(){
	   $("#showShop").hide();
	   $("#returnShop").show();
	};
	//提交驳回原因
	function submitInfo(){
		var rejectReason = $("#rejectReason6").val();
		var merchantId = $("#merchantId6").val();
		if(rejectReason==null || rejectReason ==''){
			swal("操作失败!", "驳回原因不能为空", "warning");
			return false;
		}else{
			 $.ajax({
    	         url: "<%=path %>/manager/rejectShop",
    	         timeout: 300000,
    		        type: 'post',
    		        data: {"merchantId":merchantId,"rejectReason":rejectReason},
    		        dataType: 'json',
    		        success: function (data) {
    		        	if(data==1){
			        		 swal({ 
					   			  title: "提交成功", 
					   			  text: "驳回成功", 
					   			  type: "success",
					   			},function(){
					        		 $("#tabId").bootstrapTable('refresh');
					        		 $('#myModal1').modal('hide')
					   			});
			        		 
			        	 }else{
			        		 swal({ 
					   			  title: "提交失败", 
					   			  text: "驳回失败", 
					   			  type: "error",
					   			}); 
			        	 }
    	         }
			 });
		}
	};
   </script>
</html>